from django.contrib import admin
from spark.models import (
    SysUser,
    Task,
    SysRole,
    Group,
)

# SysUser 的管理界面配置
@admin.register(SysUser)
class SysUserAdmin(admin.ModelAdmin):
    list_display = ('username', 'email', 'avatar', 'status')  # 显示字段
    search_fields = ('username', 'email')  # 添加搜索功能

# Task 的管理界面配置
@admin.register(Task)
class TaskAdmin(admin.ModelAdmin):
    list_display = ('title', 'deadline', 'status', 'created_at')  # 显示字段
    list_filter = ('status', 'deadline')  # 添加筛选功能
    search_fields = ('title',)  # 添加搜索功能

# SysRole 的管理界面配置
@admin.register(SysRole)
class SysRoleAdmin(admin.ModelAdmin):
    list_display = ('label', 'status', 'create_time', 'update_time')  # 显示字段
    list_filter = ('status',)  # 添加筛选功能

# Group 的管理界面配置
@admin.register(Group)
class GroupAdmin(admin.ModelAdmin):
    list_display = ('group_name', 'leader_id')  # 显示字段
    search_fields = ('group_name',)  # 添加搜索功能

